<?php
declare (strict_types = 1);

namespace app\api\controller\mall;

use app\BaseController;
use app\common\business\Goods;
use app\common\lib\Show;
use think\facade\Request;

class Detail extends BaseController
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        // 获取 sku ID
        $id = Request::param('id', 0, 'intval');
        if (!$id) return Show::error();

        $goods = new Goods();
        $result = $goods->getGoodsDetailBySkuId($id);
        if (!$result) return Show::error();
        return Show::success($result);
    }
}
